import 'package:bruno/bruno.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sph_shipper/AppConfig/Config.dart';

class DocumentDisputes extends StatefulWidget {
  const DocumentDisputes({super.key});

  @override
  State<DocumentDisputes> createState() => _DocumentDisputesState();
}

class _DocumentDisputesState extends State<DocumentDisputes> {
  String QAstr="";
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        centerTitle: true,
        title: Text("发起投诉",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w300),),
      ),
        body: Column(
          children: [
            Expanded(
              child: ListView(
                children: [
                  Container(
                    margin: EdgeInsets.only(top: 8.h,left: 10.w,right: 10.w),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                    ),
                    padding: EdgeInsets.only(left: 13.w,top: 15.h,bottom: 16.h),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Row(
                          children: [
                            Image.asset("lib/Images/OrderList/运单投诉手机icon.png",width: 18.w,height: 18.h,),
                            SizedBox(width: 7.w,),
                            Text("手机号",style: TextStyle(color: Colors.black,fontSize: 16.sp),),
                            Text("111****5555",style: TextStyle(color: MyColors.themeColor),),
                          ],
                        ),

                        SizedBox(height: 8.h,),
                        Container(height: 1.h,color: MyColors.backgreyColor,),
                        SizedBox(height: 15.h,),
                        Row(
                          children: [
                            Text("物流路线",style: TextStyle(color: MyColors.textColor),),
                            SizedBox(width: 8.w,),
                            Text("苏州市吴中区-苏州市吴中区",style: TextStyle(color: Colors.black),),
                          ],
                        ),
                        SizedBox(height: 6.h,),
                        Row(
                          children: [
                            Text("对方姓名",style: TextStyle(color: MyColors.textColor),),
                            SizedBox(width: 8.w,),
                            Text("张**",style: TextStyle(color: Colors.black),),
                          ],
                        ),
                        SizedBox(height: 6.h,),
                        Row(
                          children: [
                            Text("运单编号",style: TextStyle(color: MyColors.textColor),),
                            SizedBox(width: 8.w,),
                            Text("111122223333444444",style: TextStyle(color: Colors.black),),
                          ],
                        ),
                        SizedBox(height: 6.h,),
                        Row(
                          children: [
                            Text("运单状态",style: TextStyle(color: MyColors.textColor),),
                            SizedBox(width: 8.w,),
                            Text("已完成",style: TextStyle(color: Colors.black),),
                          ],
                        ),
                        SizedBox(height: 6.h,),
                        Row(
                          children: [
                            Text("运单时间",style: TextStyle(color: MyColors.textColor),),
                            SizedBox(width: 8.w,),
                            Text("2023-05-23 11:55:25",style: TextStyle(color: Colors.black),),
                          ],
                        ),
                      ],
                    ),
                  ),

                  Container(
                    margin: EdgeInsets.only(top: 8.h,left: 10.w,right: 10.w),
                    padding: EdgeInsets.only(top: 13.h,bottom: 13.h,left: 10.w,right: 10.w),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                    ),
                    child: Column(
                      children: [
                        Row(
                          children: [
                            Text("投诉类型",style: TextStyle(color: Colors.black,fontSize: 16.sp),),
                            Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 16.sp),),
                          ],
                        ),
                        SizedBox(height:10 ,),
                        Row(
                          children: [
                            Container(
                              width: 140.w,
                              height: 30.h,
                              decoration: BoxDecoration(
                                  border: Border.all(
                                    color: MyColors.themeColor, // 边框颜色
                                    width: 1.0, // 边框宽度
                                    style: BorderStyle.solid, // 边框样式
                                  ),
                                  color: Color.fromRGBO(251, 236, 228, 1),
                                  borderRadius: BorderRadius.all(Radius.circular(10))),

                              child: Center(child: Text("回单问题",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),),
                            ),
                          ],
                        ),
                        SizedBox(height:10 ,),
                        Row(
                          children: [
                            Text("遇到哪种问题",style: TextStyle(color: Colors.black,fontSize: 16.sp),),
                            Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 16.sp),),
                          ],
                        ),
                        SizedBox(height:10 ,),
                        GestureDetector(
                          child:
                            Container(
                              width: screenSize.width-40.w,
                              height: 30.h,
                              padding: EdgeInsets.only(left: 10.w,right: 10.w,top: 5.h,bottom: 5.h),
                              decoration: BoxDecoration(
                                  color: MyColors.backgreyColor,
                                  borderRadius: BorderRadius.all(Radius.circular(10))),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(QAstr,style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  Icon(Icons.arrow_drop_down,color: MyColors.authTipColor,size: 30,),
                                ],
                              ),
                            ),
                          onTap: (){
                            showModalBottomSheet(
                              context: context,
                              builder: (BuildContext context) {
                                return Container(
                                    decoration: BoxDecoration(
                                        color: Colors.white,
                                        borderRadius: BorderRadius.all(Radius.circular(10))),
                                    padding: EdgeInsets.only(top: 10.h,left: 10.w,right: 10.w),
                                    height: 300,
                                    width: screenSize.width,
                                    child: Column(
                                      crossAxisAlignment: CrossAxisAlignment.center,
                                      children: [
                                        Row(
                                          mainAxisAlignment: MainAxisAlignment.end,
                                          children: [
                                            IconButton(onPressed: (){QAstr=""; Navigator.pop(context);}, icon: Icon(Icons.close,color: MyColors.authTipColor,)),

                                          ],
                                        ),
                                        TextButton(onPressed: (){
                                          setState(() {
                                            QAstr ="回单邮寄纠纷";
                                          });
                                          Navigator.pop(context);
                                        }, child: Text("回单邮寄纠纷",style: TextStyle(color:QAstr =="回单邮寄纠纷"?MyColors.themeColor: Colors.black,fontSize: 14.sp),)),
                                        Divider(height: 1.h,color: MyColors.backgreyColor),
                                        TextButton(onPressed: (){
                                          setState(() {
                                            QAstr ="收到单据不规范";
                                          });
                                          Navigator.pop(context);
                                        }, child: Text("收到单据不规范",style: TextStyle(color: QAstr =="收到单据不规范"?MyColors.themeColor:Colors.black,fontSize: 14.sp),)),

                                      ],
                                    )
                                );
                              },
                            );
                          },
                        ),
                        SizedBox(height:10 ,),
                        Row(
                          children: [
                            Text("投诉内容",style: TextStyle(color: Colors.black,fontSize: 16.sp),),
                            Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 16.sp),),
                          ],
                        ),

                        Container(
                          margin: EdgeInsets.only(top: 10.h),
                          child: BrnInputText(
                            autoFocus: false,
                            maxHeight: 200,
                            minHeight: 30,
                            minLines: 1,
                            maxLength: 140,
                            bgColor: MyColors.backgreyColor,
                            textInputAction: TextInputAction.newline,
                            maxHintLines: 20,
                            hint: '必填，请输入您要投诉的内容',
                            padding: EdgeInsets.fromLTRB(20, 10, 20, 14),
                            onTextChange: (text) {
                              print(text);

                              setState(() {});
                            },
                            onSubmit: (text) {
                              print(text);
                            },
                          ),
                        )
                      ],
                    ),
                  ),
                ],
              ),
            ),
            Container(
              height: 85.h,
              color: Colors.white,
              padding: EdgeInsets.only(top: 10.h,bottom: 40.h),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  BrnSmallOutlineButton(
                    width: screenSize.width/2-20.w,
                    radius: 30,
                    title: '发起投诉',
                    textColor: MyColors.themeColor,
                    lineColor: MyColors.themeColor,
                    fontWeight: FontWeight.w600,
                    onTap: () {
                      BrnToast.show('次按钮', context);
                    },
                  ),
                  SizedBox(width: 10.w,),
                  BrnSmallMainButton(
                    width: screenSize.width/2-20.w,
                    radius: 30,
                    title: '联系货主',
                    textColor: Colors.white,
                    bgColor: MyColors.themeColor,
                    fontWeight: FontWeight.w600,
                    onTap: () {
                      BrnToast.show('录需求信息', context);
                    },
                  )
                ],
              ),
            )
          ],
        )
    );
  }
}
